package tech.aistar.pojo.dao;

import org.elasticsearch.index.query.QueryStringQueryBuilder;
import org.springframework.data.elasticsearch.annotations.Highlight;
import org.springframework.data.elasticsearch.annotations.HighlightField;
import org.springframework.data.elasticsearch.annotations.HighlightParameters;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;
import tech.aistar.pojo.SongList;
import tech.aistar.pojo.SongListIndex;

import java.util.List;

@Repository
public interface SongListIndexRepository extends ElasticsearchRepository<SongListIndex, Integer> {


    @Highlight(
            //字段
            fields = {@HighlightField(name = "songTitle"), @HighlightField(name = "lyrics"),@HighlightField(name = "singerName")},


            parameters = @HighlightParameters(preTags = {"<span style='color:red'>"}, postTags = {"</span>"}, numberOfFragments = 0)
    )
    List<SearchHit<SongListIndex>> findBySongTitleOrLyricsOrSingerName(String songTitle,String lyrics,String singerName);
}
